home *** CD-ROM | disk | FTP | other *** search
- !
- ! Default script ARK.SCR.
- !
- ! This is the default script for handling objects. It is invoked whenever
- ! an object is manipulated (Talk, Get, Drop, Wear, Remove, Look, Examine,
- ! Invoke, Use and Exit) under the following conditions:
- !
- ! a) If the object has a script assigned to it, that script is invoked
- ! first.
- ! b) If the object's script terminates with CONTINUE, or if the object
- ! does not have a script, then this script is invoked.
- !
- ! You may modify this script at will, but one thing to remember is that
- ! this script should NEVER terminate with CONTINUE. The reason is that
- ! objects may explicitly state that their script is 'OBJECT', in which
- ! case a 'CONTINUE' would execute this script twice! (Once as the script
- ! assigned to the object, and another time because the script ended with
- ! continue).
- !
- ! (c) DC Software, 1992
- !
-
- !------------------------------------------------------------------------!
- :@TALK ! Talk to the object or npc !
- !------------------------------------------------------------------------!
- ! This script is called whenever the object or NPC you tried to talk
- ! to does not have it's own script for handling talking. Thus, it just
- ! prints a standard message. Since nothing really happens here, we
- ! omit the check to see if the player is alive.
-
- ! gosub STILLKICKING; - don't check !
- if npc.count then
- writeln( "The ", npc.type, " has nothing to say.." );
- else
- writeln( "How do you talk to an ", object.type, "?" );
- endif;
- STOP;
-
- !------------------------------------------------------------------------!
- :@GET ! Get the object (pick it up) !
- !------------------------------------------------------------------------!
- writeln( "You can't get the Ark!" );
- STOP;
-
- !------------------------------------------------------------------------!
- :@LOOK ! Look at an object !
- !------------------------------------------------------------------------!
- L(255) = True; ! give DETAILED description !
- gosub DESCRIBE;
- STOP;
-
- !------------------------------------------------------------------------!
- :@EXAMINE ! Examine the object in detail !
- !------------------------------------------------------------------------!
- L(255) = TRUE; ! Give DETAILED description !
- gosub DESCRIBE;
- STOP;
-
-
- !------------------------------------------------------------------------!
- :@USE ! Use an object laying on the ground before us..
- !------------------------------------------------------------------------!
- !
- ! Called when an object that is laying on the ground is 'used'. Note that
- ! 'use' means different things for different object types, and that in
- ! order to invoke an item you have 'get' it and sometimes 'wear' it.
- !
- if object.endgame = END_ON_USE then
- if object.endtext > 0 then ! .. this text is displayed first.. !
- readtext( object.endtext );
- endif; ! .. then the game ends. !
- ENDGAME;
- endif;
-
- on object.type goto
- USE_FOOD, USE_WEAPON, USE_AMMO, USE_ARMOR, USE_SHIELD,
- USE_AMULET, USE_RING, USE_POTION, USE_SCROLL, USE_STAFF,
- USE_CHEST, USE_KEYS, USE_GEMS, USE_BOOK, USE_GOLDSACK,
- USE_TORCH, USE_LANTERN, USE_ROPE, USE_HOOKS, USE_MIRROR,
- USE_SIGN, USE_VEHICLE;
-
- writeln( "I don't know how to do that with the ", object.name );
- STOP;
-
- :USE_FOOD
- :USE_POTION
- if object.class then
- writeln( "You must 'get' it, then 'quaff' (eat) it.." );
- else
- writeln( "Just 'get' it.." );
- endif;
- STOP;
-
- :USE_GEMS
- :USE_SCROLL
- writeln( "You must first 'get' it, then 'invoke' it.." );
- STOP;
-
- :USE_AMULET
- :USE_RING
- :USE_ARMOR
- :USE_WEAPON
- :USE_SHIELD
- :USE_STAFF
- writeln( "You must first 'get' it, then 'wear' or 'wield' it.." );
- STOP;
-
- :USE_AMMO
- writeln( "Just carry it in your backpack. If you 'wield' a " );
- writeln( "weapon that uses this type of ammo, it will get used" );
- writeln( "automaticly." );
- STOP;
-
- :USE_CHEST
- ! Unlock the chest !
- if object.locktype then
- L(0) = 0;
- :UCLOOP
- setbp( player, L(0) );
- if player.bp.type = KEYS and player.bp.keytype = object.locktype then
- writeln( object.name, " unlocked.." );
- object.locktype = 0;
- STOP;
- endif;
- inc( L(0) );
- if L(0) < 16 goto :UCLOOP;
- writeln( "You don't have the right key! Break the lock?" );
- if getstr( "Yes", "No" ) = 0 then
- if random( 2 + adjustments(player.str) ) > 0 then
- write( "You broke the lock!" );
- if object.traptype = 1 then
- voice( "Argh", 1000 ); ! 1000 = DCSOUNDS.VFL !
- writeln( "Argh.. Poison trap!" );
- player.poisoned = 1;
- elsif object.traptype > 1 then
- voice( "Explode", 1000 ); ! Play standard sound effect !
- writeln( "Bomb Trap!" );
- dec( player.hp, object.damage );
- if player.hp = 0 then
- writeln( player.name, " has died.." );
- endif;
- endif;
- object.locktype = 0;
- else
- writeln( "It doesn't break!" );
- endif;
- else
- writeln( "Ok." );
- endif;
- else
- writeln( "It is not locked.." );
- endif;
- STOP;
-
- :USE_KEYS
- writeln( "Just 'Get' it and carry it in case you find a lock that" );
- writeln( "the key can open!" );
- STOP;
-
- :USE_BOOK
- writeln( "To read it, just 'Look' at it.." );
- STOP;
-
- :USE_GOLDSACK
- L(1) = getnum("How many gold pieces do you want to put in it?",
- 0, group.gold / 10) * 10;
- if L(1) then
- writeln( "You put ", $L1, " in the bag." );
- inc( object.value, L(1) );
- dec( group.gold, L(1) );
- else
- writeln( "Smart move.." );
- endif;
- STOP;
-
- :USE_TORCH
- :USE_LANTERN
- writeln( "Save your torches.. I haven't implemented LIGHT yet!" );
- STOP;
-
- :USE_ROPE
- writeln( "After fooling around with it for a while, you manage to" );
- writeln( "get yourself tangled up..." );
- STOP;
-
- :USE_HOOKS
- voice( "Ouch", 1000 );
- writeln( "Ouch! (it's sharp!)" );
- STOP;
-
- :USE_MIRROR
- writeln( "Yes, you are ugly, but that doesn't matter here.." );
- STOP;
-
- :USE_SIGN
- writeln( "It's not yours. You can 'Read' it if you wish.." );
- STOP;
-
- :USE_VEHICLE
- if group.vehicle.count then
- writeln( "You cannot use the ark! It's no longer seaworthy!" );
- writeln( "It would sink in seconds!" );
- STOP;
- endif;
- if object.x <> group.x and object.y <> group.y then
- writeln( "You cannot use the ark! It's no longer seaworthy! " );
- endif;
- STOP;
-
-
- !------------------------------------------------------------------------!
- :@ATTACK ! Attack an object or a person !
- !------------------------------------------------------------------------!
- if npc.count then
- if npc.type = HOSTILE then
- FIGHT;
- !- Script ends when you 'FIGHT' -!
- endif;
- writeln( "How DARE you try and fight such a noble ship! Find some bad guys to fight!" );
- STOP;
- endif;
- if object.type = CHEST then
- if object.locktype then
- writeln( "Instead of fighting it, try 'UNLOCK'!" );
- else
- writeln( "It's not even locked, why fight it?" );
- endif;
- else
- writeln( "Why would you want to fight the ", object.name );
- endif;
- STOP;
-
- !------------------------------------------------------------------------!
- !-- SCRIPT SUBROUTINES ARE GROUPED HERE AT THE END. THIS IS A CHOICE --!
- !-- NOT A REQUIREMENT. IT MAKES THE MAIN SCRIPT CODE ABOVE A LITTLE --!
- !-- BIT EASIER TO FOLLOW. ---------------------------------------------!
- !------------------------------------------------------------------------!
-
-
- !------------------------------------------------------------------------!
- ! STILLKICKING: Subroutine to verify that the player is alive before !
- ! allowing him/her/it to perform an action. !
- !------------------------------------------------------------------------!
- :STILLKICKING
- if player.hp = 0 then
- writeln( player.name, " is dead!" );
- STOP;
- endif;
- RETURN;
-
- !------------------------------------------------------------------------!
- !
- ! SUBROUTINE: DESCRIBE
- !
- ! This routine is invoked from @LOOK, @EXAMINE and by the ANALYZE spell
- ! to describe a given item.
- !
- !------------------------------------------------------------------------!
- :DESCRIBE
- !------------------------------------------------------------------------!
-
- ! First, handle the case where you are looking at a CHARACTER
-
- if npc.count then
- if npc.picture >= 0 then
- viewpcx( npc );
- if success then
- pause;
- endif;
- paint(window); ! Assumes the picture fits in the window !
- endif;
- write( " " );
- if npc.type = HOSTILE and npc.weapon.count then
- write( ", Weapon: ", npc.weapon.name, ", Damage: ", npc.weapon.damage, ", Range: ", npc.weapon.range );
- endif;
- if L(255) then
- write( ", Class: ", npc.class, ", Lvl: ", npc.level, ", AC: ", npc.ac, ", HP: ", npc.hp );
- endif;
- writeln(".");
- STOP;
- endif;
- if object.picture >= 0 then
- viewpcx( object );
- if success then
- pause;
- endif;
- paint(window); ! Assumes the picture fits in the window !
- elsif object.type = SIGN or object.type = BOOK then
- readtext( object.text );
- STOP;
- endif;
- write( " " );
- if NOT L(255) then
- writeln;
- STOP;
- endif;
- write( " " );
- !
- ! The following is a 'cascading if..then..elsif..elsif.....else..endif'
- ! statement. It is used here to illustrate it's usefulness. The same
- ! code could have been written with a 'ON object.type GOTO' statement.
- !
- if object.type = FOOD or object.type = POTION then
- if object.class then
- write( ", Class: ", object.class );
- if object.class <> CURE then
- write( ", Units: ", object.units );
- endif;
- endif;
- elsif object.type = WEAPON then
- write( ", Class: ", object.class,
- ", Hands: ", object.hands,
- ", Range: ", object.range,
- ", Damage: ", object.damage );
- if object.ammoneeded then
- write( ", Needs ammo type: ", object.ammo_type );
- endif;
- elsif object.type = AMMO then
- write( ", Ammo Type: ", object.ammotype );
- if object.traptype then
- write( ", Poisoned" );
- endif;
- if object.damage then
- write( ", Extra Damage: ", object.damage );
- endif;
- elsif object.type = ARMOR or object.type = SHIELD then
- write( ", Armor Class: ", object.ac );
- if object.cursed then
- write( " Cursed!" );
- endif;
- elsif object.type = AMULET or object.type = RING or object.type = GEMS then
- if object.class then
- write( ", Class: ", object.class );
- write( ", Charges: ", object.charges );
- if object.class <> CURE then
- write( ", Units: ", object.units );
- if object.permanent then
- write( ", Permanent!" );
- else
- write( ", Temporary" );
- endif;
- endif;
- if object.cursed then
- write( ", Cursed!" );
- endif;
- endif;
- elsif object.type = SCROLL then
- write( ", Class: ", object.class );
- elsif object.type = STAFF then
- write( ", Class: ", object.class, ", Charges: ", object.charges );
- elsif object.type = CHEST then
- if object.locktype then
- write( ", Locked!" );
- if object.traptype = 0 then
- write( ", no traps" );
- elsif object.traptype = 1 then
- write( ", poison trap" );
- else
- write( ", bomb damage: ", object.traptype );
- endif;
- endif;
- ! elsif object.type = KEYS then
- ! nothing special about it
- ! elsif object.type = BOOK then
- ! nothing special about it
- ! elsif object.type = GOLDSACK then
- ! nothing special about it
- ! elsif object.type = TORCH then
- ! nothing special about it
- ! elsif object.type = LANTERN then
- ! nothing special about it
- ! elsif object.type = ROPE then
- ! nothing special about it
- ! elsif object.type = HOOKS then
- ! nothing special about it
- ! elsif object.type = MIRROR then
- ! nothing special about it
- ! elsif object.type = SIGN then
- ! nothing special about it
- elsif object.type = VEHICLE then
- write( "It's Noah's Ark!!!!! You found it!!!!!!! " );
- write( "Now you'll be rich and famous!!!!!!! " );
- write( "NOT!!!!! " );
- ! else
- ENDIF;
- ! user defined type?
- return;
-
-